supermarioworldfandomcom-20200214-history
65c816 Instructions
There are approximately 91 opcodes in ASM. They are divided into different categories. Loading Instructions These instructions load an 8-bit or a 16-bit value into one of the three registers. Compare Instructions These instructions, usually used with branch commands, compare one of the three registers with a value or memory. (They essentially subtract the value following the compare instruction from the value in the register, affecting the processor flags but not the register itself.) Storage Instructions These instructions store various values from a register into memory. STA - Store Accumulator to Memory STX - Store X to Memory STY - Store Y to Memory STZ - Store Zero to Memory Branching Instructions These instructions branch depending on the processor flags status, except BRA and BRL, which always branch regardless of the processor flags. BCC - Branch if Carry Clear BCS - Branch if Carry Set BPL - Branch if Plus Value BMI - Branch if Minus Value BNE - Branch if Not Equal/Branch if Not Zero BEQ - Branch if Equal/Branch if Zero BVC - Branch if Overflow Clear BVS - Branch if Overflow Set BRL - Branch Always Long BRA - Branch Always Mathematical Instructions These instructions perform addition and subtraction with the registers and memory. (Note that there are no opcodes for multiplication and division; special registers must be used for those.) ADC - Add with Carry SBC - Subtract with Carry INC - Increment Accumulator or Memory INX - Increment X INY - Increment Y DEC - Decrement Accumulator or Memory DEX - Decrement X DEY - Decrement Y Processor Flag Instructions These instructions set or clear various processor flags of the SNES. SEP - Set Processor Status Flag REP - Reset Processor Status Flag SEC - Set Carry Flag SED - Set Decimal Flag SEI - Set Interrupt Flag CLC - Clear Carry Flag CLD - Clear Decimal Flag CLI - Clear Interrupt Flag CLV - Clear Overflow Flag XCE - Exchange Carry and Emulation (swaps bits of emulation flag and carry flag, toggling emulation mode on/off) Stack Instructions These instructions push and pull various bytes on/from the stack, a special designated area of RAM that is located at $01FF-$010B in SMW. PEA - Push Effective Address (Simply push a 16-bit absolute value on the stack) PEI - Push Effective Indirect Address PER - Push Program Counter Relative PHA - Push Accumulator PHB - Push Data Bank Register PHD - Push Direct Page Register PHK - Push Program Bank Register PHP - Push Processor Status Flags PHX - Push X PHY - Push Y PLA - Pull Accumulator PLB - Pull Data Bank Register PLD - Pull Direct Page Register PLP - Pull Processor Status Flags PLX - Pull X PLY - Pull Y Bitwise Instructions These operations affect the individual bits of A and/or memory. AND - AND Accumulator with Memory ASL - Left Shift Accumulator or Memory BIT - Bit Test EOR - Exclusive OR Accumulator with Memory LSR - Shift Right Accumulator or Memory ORA - OR Accumulator with Memory ROL - Rotate Left Accumulator or Memory ROR - Rotate Right Accumulator or Memory TRB - Test and Reset Bit TSB - Test and Set Bit Transfer Instructions These opcodes transfer values from register to register (or, in the case of MVN and MVP, from memory to memory). TAX - Transfer Accumulator to X TAY - Transfer Accumulator to Y TCD - Transfer Accumulator to Direct Page TCS - Transfer Accumulator to Stack Pointer TDC - Transfer Direct Page to Accumulator TSC - Transfer Stack Pointer to Accumulator TSX - Transfer Stack Pointer to X TXA - Transfer X to Accumulator TXS - Transfer X to Stack Pointer TXY - Transfer X to Y TYA - Transfer Y to Accumulator TYX - Transfer Y to X MVN - Block Move Negative MVP - Block Move Positive Program Flow Instructions These instructions jump into some other part of the ROM/RAM. JML - Jump Long JMP - Jump JSL - Jump to Subroutine Long JSR - Jump to Subroutine RTI - Return from Interrupt RTL - Return from Subroutine Long RTS - Return from Subroutine Other Instructions These are other misc. opcodes. BRK - Software Break (Sets the B flag in emulation mode, interrupt in native) COP - Coprocessor Empowerment (interrupt) NOP - No Operation (does absolutely nothing except waste a cycle of processing time) STP - Stop the Clock (freezes the SNES's processor) WAI - Wait for Interrupt XBA - Exchanges low and high byte of the A register External Links List of all opcodes, their hexadecimal equivalents and the amount of cycles they take. Category:ASM Category:Lists